<?php

namespace common\validate;

class Excel extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this;
    }

    // Import 验证场景定义
    public function sceneImport()
    {
        return $this->append('header', 'require|array')
            ->append('header_mapping', 'require|array')
            ->append('body', 'require|array')
            ->append('fields', 'require|array')
            ->append('module_code', 'require')
            ->append('project_id', 'require')
            ->append('images_column', 'array');
    }

    // FormatExcelFileData 验证场景定义
    public function sceneFormatExcelPasteData()
    {
        return $this->append('has_header', 'require|in:yes,no')
            ->append('parsed', 'require|array')
            ->append('module_code', 'require');
    }

    // FormatExcelFileData 验证场景定义
    public function sceneFormatExcelFileData()
    {
        return $this->append('has_header', 'require|in:yes,no')
            ->append('module_code', 'require');
    }

    // CheckExcelFileData 验证场景定义
    public function sceneCheckExcelFileData()
    {
        return $this->append('project_id', 'require')
            ->append('body', 'require|array')
            ->append('header_mapping', 'require|array');
    }

    // CheckFormData 验证场景定义
    public function sceneCheckFormData()
    {
        return $this->append('project_id', 'require')
            ->append('rows', 'require|array')
            ->append('module_code', 'require');
    }

    public function sceneCheckUpdateTaskDateData()
    {
        return $this->append('data_list', 'require|array')
            ->append('project_id', 'require|integer');
    }

    // CheckUpdateTaskDateDataItem 验证场景定义
    public function sceneCheckUpdateTaskDateDataItem()
    {
        return $this
            ->append('initial_episode_code', 'require')
            ->append('showings_number', 'require')
            ->append('name', 'require')
            ->append('step_name', 'require')
            ->append("manual_man_hour", "float|egt:0");
    }

}
